import 'package:flutter/material.dart';
import 'package:flutter_basic_learning/utils/CommonWidget.dart';
import 'package:flutter_basic_learning/utils/SwiperUtils.dart';

class PageViewPage extends StatefulWidget {
  const PageViewPage({super.key});

  @override
  State<PageViewPage> createState() => _PageViewPageState();
}

class _PageViewPageState extends State<PageViewPage> {
  List<Widget> pageViewList = [
    loadNetworkImage(
      'https://miaobi-lite.bj.bcebos.com/miaobi/5mao/b%27LV8xNzM2ODA5MTAxLjYwNDkyMTg%3D%27/0.png?authorization=bce-auth-v1%2FALTAKmda7zOvhZVbRzBLewvCMU%2F2025-01-13T22%3A58%3A21Z%2F-1%2F%2F818c3d1f37bcb7e714e938d478f48c224709679dca3c7cf4dce3e8ae28804def',
      imgHeight: 100,
      imgWidth: double.infinity,
    ),
    loadNetworkImage(
      'https://img1.baidu.com/it/u=357590728,679892888&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=654',
      imgHeight: 100,
      imgWidth: double.infinity,
    ),
    loadNetworkImage(
      'https://img1.baidu.com/it/u=2306993068,1631991477&fm=253&fmt=auto&app=138&f=JPEG?w=760&h=475',
      imgHeight: 100,
      imgWidth: double.infinity,
    ),
  ];
  late PageController pageController;
  @override
  void initState() {
    // TODO: implement initState
    super.initState();
  }

  Widget pageViewItem(int index) {
    Widget body = Container(
      width: 200,
      height: 150,
      color: Colors.black12,
      child: Center(
        child: commonTitle('PageViewItem${index}'),
      ),
    );
    body = Align(
      alignment: Alignment.center,
      child: body,
    );

    return body;
  }

  Widget body() {
    Widget body = SwiperUtils(pageList: pageViewList);
    return body;
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: commonAppBar('PageView学习页面'),
      body: body(),
    );
  }
}
